
#include "Game.h"

using namespace Iride;

Game::Game(IGraphics* pGraphics, IInput* pInput):
 mpGraphics(pGraphics), mpInput(pInput)
{

}

Game::~Game()
{

}

int Game::Execute()
{
    bool running = true;

    if(Init() == false)
    {
        return -1;
    }

    while(running)
    {
        running = HandleInput();

		Update();

		Render();
    }

	CleanUp();

	return 0;
}


bool Game::Init()
{
	bool res = mpGraphics->Init();
	res &= mpInput->Init();

	return res;
}

void Game::Render()
{
    mpGraphics->Render();
}

void Game::Update()
{
    mpGraphics->Update();
}

bool Game::HandleInput()
{
   return mpInput->GetInput();
}

void Game::CleanUp()
{
  mpGraphics->Cleanup();
}

